package com.boot.sharding.service;

import com.boot.sharding.dao.User;
import com.boot.sharding.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: zj
 * @Description:
 * @Date: Created in 11:56 2020/8/11
 * @Modified By:
 */
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public User findUserById(Integer id) {
        return userMapper.findById(id);
    }

    public void insertUser(String username, Integer age) {
        User user = new User();
        user.setUser_name(username);
        user.setAge(age);
        userMapper.insert(user);
    }
}
